<?php
	require_once $_SERVER['DOCUMENT_ROOT'] . '/SAGER/model/factory/DaoFactory.php';
	
	error_reporting (E_ALL ^ E_NOTICE);
	
	$debug = $_SESSION['debug'];
	
	/*
	* Class to select given request details
	*/
	class CommandSelectRequestDetails extends CustomCommand {
		/*
		 * Constructor of the class
		 */
		public function __construct($number, $controlNumber) {
			$this -> number = $number;	
			$this -> controlNumber = $controlNumber;	
		}
		
		/*
		 * Method to execute to select given request details
		 */
		public function execute() {
			$daoFactory = DaoFactory :: getMySqlDaoFactory();
			$irdad = $daoFactory -> getMySqlRequestDetailAccessDao();			
			$sentence = $irdad -> selectRequestDetails($this -> number, $this -> controlNumber);
			
			$requests = ''; $i = 0;
			while ($row = mysql_fetch_array($sentence)) {
				$products['pk_line'][$i] = $row['pk_line'];
				$products['name'][$i] = $row['name'];
				$products['units'][$i] = $row['units'];
				$products['quantity'][$i] = $row['quantity'];
				$products['unit_cost'][$i] = $row['unit_cost'];
				$products['total'][$i] = $row['total'];
				$products['tax'][$i++] = $row['tax'];
			}			
			
			$this -> result = $products;
		}
	}
?>